// GameTime.h
//
// Keeps track of how much time has elapsed since the game has started,
// and allows for pauses without messing up time-based functions.
//
// Nick Kitten
// 2009

#pragma once

#include "DarkGDK.h"

class GameTime
{
public:
	GameTime() : elapsedTime(0) {}
	~GameTime() {}

	// Sets the global game time to 0
	static void initialize();

	// Gets the current global game time
	static int getTime();

	// Used in conjunction with stopTimer() to time an event
	void startTimer();

	// Returns the elapsed time in ms since startTimer() was called
	int stopTimer();

	// Pauses game time
	static void pause();

	// Resumes updating of game time
	static void unpause();

private:
	// How much time to subtract from dbTimer() to get the
	// elapsed game time, not including pauses.
	static int offset;

	// At what system time the game was paused
	static int pauseTime;

	// elapsed time since the timer was started
	int elapsedTime;
};